<!DOCTYPE html>
<html>
<head>
<title>req_assign</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="stylesheet" type="text/css"
	href="/codebase/fonts/font_roboto/roboto.css" />
<link rel="stylesheet" type="text/css" href="/codebase/dhtmlx.css" />
<script type="text/javascript" src="/codebase/dhtmlx.js" ></script>
<style>
div#simpleLog {
	height: 200px;
	font-family: Roboto, Arial, Helvetica;
	font-size: 14px;
	color: #404040;
	overflow: auto;
}

div#my_tabbar {
	width:1000px;
	height: 600px;
	border: 1px solid #dfdfdf;
}

</style>
<script>
	var myForm, myForm2,myGrid,my_form2;
	
	var customCss = {
		video_bitrate : "validate_magenta",
		video_codec : "validate_orange"
	};
	
	function doOnLoad() {		
		//form setup
		if (myForm) {
			myForm.unload();
			myForm = null;

		}
		myForm = new dhtmlXForm("form_container");
		//myForm.loadStruct("/common/testmanager/test_assign.xml");
		myForm.loadStruct("/test/test_assign_list_form_load");
		
		myForm.attachEvent("onButtonClick", function(name) {		
			
			if(name=="query_btn"){
				var req_title = myForm.getItemValue("query_req_title");
				var req_bill_no = myForm.getItemValue("query_req_bill_no");
				var technical_director = myForm.getItemValue("query_technical_director");
				var params_tmp = req_title + "," + req_bill_no + ","
						+ technical_director;
				myGrid.clearAndLoad("/test/test_assign_select_req_grid?params="+params_tmp,"json");
			}			

		});		
	
	
		//grid setup
		if (myGrid) {			
			myGrid.clearAll(true);			
		}
		myGrid = new dhtmlXGridObject("grid_req_list");
		//myGrid.loadStruct("/common/testmanager/req_list.xml");
		myGrid.setImagePath("/codebase/imgs/");

		myGrid.setHeader(",ID,需求编号,需求类型,需求主题,需求提出部门,缺陷号");
		myGrid.setInitWidths("50,50,150,100,250,150,150");
		myGrid.setColAlign("center,center,left,left,left,left,left");
		myGrid.setColTypes("ra,ro,ed,ro,ed,ro,ro");
		myGrid.setColSorting("str,str,str,str,str,str,str");
		//myGrid.setColumnIds("first,second");
		myGrid.xml.top = "mytop";
		myGrid.xml.row = "./myrow";
		//myGrid.enableAutoWidth(true);
		//myGrid.enableAutoHeight(true);
		myGrid.init();		
		
		myGrid.attachEvent("onRowSelect",function(rowID,celInd){
		    //alert("The id of the selected row is "+rowID);		    
		    myGrid.cells(rowID,0).setValue("1");
		    
		});
		
		var req_title=document.getElementById("req_title").innerHTML;
		var req_bill_no=document.getElementById("req_bill_no").innerHTML;
		var technical_director=document.getElementById("technical_director").innerHTML;
		var params_tmp = req_title + "," + req_bill_no + ","+ technical_director;
		
		//myGrid.load("/test/test_assign_select_req_grid?params="+params_tmp,"json");
		//myGrid.load("/common/testmanager/req_list_test_data.xml", "xml");
		//alert("loadStruct");
		
		// button setup
		formStructure2=null;
		formStructure2=[					   
		               {type:"button",name:"assign_btn1",id:"assign_btn1",value:"分配"}
			               ];
		
		if (my_form2) {
			my_form2.unload();
			my_form2 = null;

		}
		my_form2=new dhtmlXForm("form_btn");
		my_form2.loadStruct(formStructure2);
		
		my_form2.attachEvent("onButtonClick", function(name) {		
			
			if(name=="assign_btn1"){
				var get_row=myGrid.getCheckedRows(0);
				var get_test_id=myGrid.cells(get_row,1).getValue();		
				myLayout.cells("a").detachObject(true);		
				myLayout.cells("a").attachURL("/test/test_assign?test_id="+get_test_id, true); 
								
		/* 		var get_row=myGrid.getCheckedRows(0);
				var get_req_id=myGrid.cells(get_row,1).getValue();	
				
				document.getElementById("assign_req_id").innerHTML=get_req_id;
				//alert(" get_req_id "+get_req_id);
				parent.dhxWins.window("select_req_window").close();
				window.location.pathname="/test/test_assign?req_id="+get_req_id;	 */
			}			

		});		
	

	}	

</script>
</head>
<body onload="doOnLoad();">
<div id="assign_req_id" name="assign_req_id"  style="display: none;" > </div>
<div id="req_title" name="req_title" th:text="${req_title}" style="display: none;" > </div>
<div id="req_bill_no" name="req_bill_no" th:text="${req_bill_no}" style="display: none;" > </div>
<div id="technical_director" name="technical_director" th:text="${technical_director}" style="display: none;" > </div>
	<table>
		<tr>
			<td>
				<div id="form_container" style="padding-left: 100px;" ></div>
			</td>
		</tr>
	</table>		
	<table>
		<tr>
			<td>
				<div id="grid_req_list"
					style="width: 1000px; height: 200px; background-color: white;">
					</div>
			</td>
		</tr>
	</table>
	<table>
		<tr>
			<td>
				<div id="form_btn" style="padding-left: 50px;"></div>
			</td>
		</tr>
		
	</table>
</body>
</html>